<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: syx
  Date: 2021/12/20
  Time: 9:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script src="bootstrap-4.6.0-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="bootstrap-4.6.0-dist/css/bootstrap.min.css">
</head>
<body>
<form action="list.do" method="post">
    <input type="hidden" name="pageNum">
</form>

    <div class="container">
        <div class="row">
        <c:forEach items="${pageInfo.list}" var="li">
            <div class="card col-lg-4">
                <div class="card-body">
                    编号:${li.sid}<br>
                    归属:${li.asc}<br>
                    商品名称:${li.sname}<br>
                    图片:
                    <img src="${li.pic}" alt="无法显示" width="150px">
                    <br>
                    型号:${li.mods}<br>
                    规格:${li.spe}<br>
                    价格:${li.price}<br>
                    品牌:${li.pname}<br>
                    类型:${li.tname}<br>
                    登录人:${li.uname}<br>
                    身份:
                    <c:if test="${li.sta==1}">
                        管理员
                    </c:if>
                    <c:if test="${li.sta==0}">
                        用户
                    </c:if>
                    <br>
                </div>
            </div>
        </c:forEach>
        </div>
    </div>
    <div style="text-align:center">
        <tr>
            <td colspan="20">
                <button onclick="fy(1)">首页</button>
                <button onclick="fy(${pageInfo.isFirstPage?1:pageInfo.prePage})">上页</button>
                <button onclick="fy(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">下页</button>
                <button onclick="fy(${pageInfo.pages})">尾页</button>
                第${pageInfo.pageNum}/${pageInfo.pages}页
                <button onclick="addTo()">添加</button>
            </td>
        </tr>
    </div>
</body>
<script>
    function fy(pageNum){
        $("[name='pageNum']").val(pageNum)
        $("form").submit()
    }
    function addTo() {
        location="addTo.do";
    }
</script>
</html>
